package com.hksj.Intelligentmanagement.controller;

import com.hksj.Intelligentmanagement.common.Result;
import com.hksj.Intelligentmanagement.dto.OperatingRoomInfoAndSurgicalAssistantDTO;
import com.hksj.Intelligentmanagement.dto.OperatingRoomInfoDTO;
import com.hksj.Intelligentmanagement.service.OperatingRoomInfoService;
import com.hksj.Intelligentmanagement.vo.OperatingRoomInfoVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @ClassName OperatingRoomInfoController
 * @Description TODO
 * @Author @陈章
 * @Date 2023/3/31 16:09
 * @Version 1.0
 */
@Api(tags = "手术科室关联信息")
@RestController
@RequestMapping("/api/OperatingRoomInfo")
public class OperatingRoomInfoController {


    @Autowired
    private OperatingRoomInfoService operatingRoomInfoService;

    @ApiOperation(value = "手术科室关联信息")
    @PostMapping("/addOperatingRoomInfo")
    public Result addOperatingRoomInfo(@RequestBody OperatingRoomInfoDTO operatingRoomInfoDTO) {
        operatingRoomInfoService.addOperatingRoomInfo(operatingRoomInfoDTO);
        return Result.ok();
    }


    @ApiOperation(value = "添加手术科室人员三者关联信息")
    @PostMapping("/addOperatingRoomInfoAndSurgicalAssistant")
    public Result addOperatingRoomInfoAndSurgicalAssistant(@RequestBody List<OperatingRoomInfoAndSurgicalAssistantDTO> dto) {
        operatingRoomInfoService.addOperatingRoomInfoAndSurgicalAssistant(dto);
        return Result.ok();
    }


    @ApiOperation(value = "取消手术科室人员三者关联信息")
    @GetMapping("/delOperatingRoomInfoAndSurgicalAssistant")
    /**
     *
     * @param surgicalInfoId   手术信息id
     * com.hksj.operatingmanagement.common.Result
     */
    public Result delOperatingRoomInfoAndSurgicalAssistant(String surgicalInfoId) {
        operatingRoomInfoService.delOperatingRoomInfoAndSurgicalAssistant(surgicalInfoId);
        return Result.ok();
    }


    @ApiOperation(value = "查询所有手术科室人员三者关联信息")
    @PostMapping("/selectAllOperatingRoomInfoAndSurgicalAssistant")
    public Result selectAllOperatingRoomInfoAndSurgicalAssistant(String time,String name) {
        List<OperatingRoomInfoVo> list=operatingRoomInfoService.selectAllOperatingRoomInfoAndSurgicalAssistant(time,name);
        return Result.ok(list);
    }


}
